{
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "# Anomaly Detection"
      ],
      "metadata": {}
    },
    {
      "cell_type": "code",
      "source": [
        "import numpy as np\n",
        "import matplotlib.pyplot as plt\n",
        "import seaborn as sns\n",
        "import pandas as pd\n",
        "\n",
        "import warnings\n",
        "warnings.filterwarnings(\"ignore\")\n",
        "\n",
        "# fix_yahoo_finance is used to fetch data \n",
        "import fix_yahoo_finance as yf\n",
        "yf.pdr_override()"
      ],
      "outputs": [],
      "execution_count": 1,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# input\n",
        "symbol = 'AMD'\n",
        "start = '2007-01-01'\n",
        "end = '2018-12-28'\n",
        "\n",
        "# Read data \n",
        "dataset = yf.download(symbol,start,end)\n",
        "\n",
        "# View Columns\n",
        "dataset.head()"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "[*********************100%***********************]  1 of 1 downloaded\n"
          ]
        },
        {
          "output_type": "execute_result",
          "execution_count": 2,
          "data": {
            "text/plain": [
              "                 Open       High        Low      Close  Adj Close    Volume\n",
              "Date                                                                       \n",
              "2007-01-03  20.080000  20.400000  19.350000  19.520000  19.520000  28350300\n",
              "2007-01-04  19.660000  19.860001  19.320000  19.790001  19.790001  23652500\n",
              "2007-01-05  19.540001  19.910000  19.540001  19.709999  19.709999  15902400\n",
              "2007-01-08  19.709999  19.860001  19.370001  19.469999  19.469999  15814800\n",
              "2007-01-09  19.450001  19.709999  19.370001  19.650000  19.650000  14494200"
            ],
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Open</th>\n",
              "      <th>High</th>\n",
              "      <th>Low</th>\n",
              "      <th>Close</th>\n",
              "      <th>Adj Close</th>\n",
              "      <th>Volume</th>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>Date</th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>2007-01-03</th>\n",
              "      <td>20.080000</td>\n",
              "      <td>20.400000</td>\n",
              "      <td>19.350000</td>\n",
              "      <td>19.520000</td>\n",
              "      <td>19.520000</td>\n",
              "      <td>28350300</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2007-01-04</th>\n",
              "      <td>19.660000</td>\n",
              "      <td>19.860001</td>\n",
              "      <td>19.320000</td>\n",
              "      <td>19.790001</td>\n",
              "      <td>19.790001</td>\n",
              "      <td>23652500</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2007-01-05</th>\n",
              "      <td>19.540001</td>\n",
              "      <td>19.910000</td>\n",
              "      <td>19.540001</td>\n",
              "      <td>19.709999</td>\n",
              "      <td>19.709999</td>\n",
              "      <td>15902400</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2007-01-08</th>\n",
              "      <td>19.709999</td>\n",
              "      <td>19.860001</td>\n",
              "      <td>19.370001</td>\n",
              "      <td>19.469999</td>\n",
              "      <td>19.469999</td>\n",
              "      <td>15814800</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2007-01-09</th>\n",
              "      <td>19.450001</td>\n",
              "      <td>19.709999</td>\n",
              "      <td>19.370001</td>\n",
              "      <td>19.650000</td>\n",
              "      <td>19.650000</td>\n",
              "      <td>14494200</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 2,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# Create more data\n",
        "dataset['Increase_Decrease'] = np.where(dataset['Volume'].shift(-1) > dataset['Volume'],1,0)\n",
        "dataset['Buy_Sell_on_Open'] = np.where(dataset['Open'].shift(-1) > dataset['Open'],1,0)\n",
        "dataset['Buy_Sell'] = np.where(dataset['Adj Close'].shift(-1) > dataset['Adj Close'],1,0)\n",
        "dataset['Return'] = dataset['Adj Close'].pct_change()\n",
        "dataset = dataset.dropna()\n",
        "dataset.head()"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 3,
          "data": {
            "text/plain": [
              "                 Open       High        Low      Close  Adj Close    Volume  \\\n",
              "Date                                                                          \n",
              "2007-01-04  19.660000  19.860001  19.320000  19.790001  19.790001  23652500   \n",
              "2007-01-05  19.540001  19.910000  19.540001  19.709999  19.709999  15902400   \n",
              "2007-01-08  19.709999  19.860001  19.370001  19.469999  19.469999  15814800   \n",
              "2007-01-09  19.450001  19.709999  19.370001  19.650000  19.650000  14494200   \n",
              "2007-01-10  19.639999  20.020000  19.500000  20.010000  20.010000  19783200   \n",
              "\n",
              "            Increase_Decrease  Buy_Sell_on_Open  Buy_Sell    Return  \n",
              "Date                                                                 \n",
              "2007-01-04                  0                 0         0  0.013832  \n",
              "2007-01-05                  0                 1         0 -0.004043  \n",
              "2007-01-08                  0                 0         1 -0.012177  \n",
              "2007-01-09                  1                 1         1  0.009245  \n",
              "2007-01-10                  1                 1         1  0.018321  "
            ],
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Open</th>\n",
              "      <th>High</th>\n",
              "      <th>Low</th>\n",
              "      <th>Close</th>\n",
              "      <th>Adj Close</th>\n",
              "      <th>Volume</th>\n",
              "      <th>Increase_Decrease</th>\n",
              "      <th>Buy_Sell_on_Open</th>\n",
              "      <th>Buy_Sell</th>\n",
              "      <th>Return</th>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>Date</th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>2007-01-04</th>\n",
              "      <td>19.660000</td>\n",
              "      <td>19.860001</td>\n",
              "      <td>19.320000</td>\n",
              "      <td>19.790001</td>\n",
              "      <td>19.790001</td>\n",
              "      <td>23652500</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0.013832</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2007-01-05</th>\n",
              "      <td>19.540001</td>\n",
              "      <td>19.910000</td>\n",
              "      <td>19.540001</td>\n",
              "      <td>19.709999</td>\n",
              "      <td>19.709999</td>\n",
              "      <td>15902400</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>-0.004043</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2007-01-08</th>\n",
              "      <td>19.709999</td>\n",
              "      <td>19.860001</td>\n",
              "      <td>19.370001</td>\n",
              "      <td>19.469999</td>\n",
              "      <td>19.469999</td>\n",
              "      <td>15814800</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>-0.012177</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2007-01-09</th>\n",
              "      <td>19.450001</td>\n",
              "      <td>19.709999</td>\n",
              "      <td>19.370001</td>\n",
              "      <td>19.650000</td>\n",
              "      <td>19.650000</td>\n",
              "      <td>14494200</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.009245</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2007-01-10</th>\n",
              "      <td>19.639999</td>\n",
              "      <td>20.020000</td>\n",
              "      <td>19.500000</td>\n",
              "      <td>20.010000</td>\n",
              "      <td>20.010000</td>\n",
              "      <td>19783200</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.018321</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 3,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "dataset.shape"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 4,
          "data": {
            "text/plain": [
              "(3018, 10)"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 4,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "X = dataset[['Open', 'High', 'Low', 'Volume']].values\n",
        "y = dataset['Buy_Sell'].values"
      ],
      "outputs": [],
      "execution_count": 5,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn import metrics\n",
        "from sklearn.model_selection import train_test_split"
      ],
      "outputs": [],
      "execution_count": 6,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 0)"
      ],
      "outputs": [],
      "execution_count": 7,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn.ensemble import IsolationForest\n",
        "\n",
        "model = IsolationForest()"
      ],
      "outputs": [],
      "execution_count": 8,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "model.fit(X_test)"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 9,
          "data": {
            "text/plain": [
              "IsolationForest(behaviour='old', bootstrap=False, contamination='legacy',\n",
              "        max_features=1.0, max_samples='auto', n_estimators=100,\n",
              "        n_jobs=None, random_state=None, verbose=0)"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 9,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "y_pred = model.predict(X_test)"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "C:\\Users\\Tin Hang\\Anaconda3\\envs\\py35\\lib\\site-packages\\sklearn\\ensemble\\iforest.py:418: DeprecationWarning: threshold_ attribute is deprecated in 0.20 and will be removed in 0.22.\n",
            "  \" be removed in 0.22.\", DeprecationWarning)\n"
          ]
        }
      ],
      "execution_count": 12,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "print('Anomaly Detection Score:') \n",
        "sklearn_score_anomalies = model.decision_function(X_test)\n",
        "score = [-1*s + 0.5 for s in sklearn_score_anomalies]\n",
        "print(score)"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Anomaly Detection Score:\n",
            "[0.40935756963442016, 0.47633790271693449, 0.54017926018857121, 0.40286363968056177, 0.41055012534261981, 0.40697620584274263, 0.43998745594148353, 0.40414322049217466, 0.60454525308124951, 0.40520002530887039, 0.42985011238567411, 0.40149384952479478, 0.46866133486550315, 0.41730542643852797, 0.44244457125503217, 0.43928238500507749, 0.42985990133572388, 0.45600750455687289, 0.43747670691472018, 0.39548025781347573, 0.44505215271777238, 0.44388462839343779, 0.40011541446463422, 0.47787917886727521, 0.50645834661067324, 0.45120429521981081, 0.4066452924526337, 0.58080502470275097, 0.40260378682464781, 0.48914833638008282, 0.42528830717543875, 0.43790513871272863, 0.41168201469525506, 0.45679745920987203, 0.40520297829482244, 0.43817234615483186, 0.45714766697880421, 0.51106329395066508, 0.43619350203472396, 0.43587790406452809, 0.52938376181757563, 0.39571686807824025, 0.41185493292256442, 0.47645591448176822, 0.63426024197245368, 0.41723601930750381, 0.43476496865062964, 0.404698494187197, 0.47561200612170235, 0.42174083687533592, 0.53344839291150126, 0.4138431281359049, 0.40904347906045213, 0.4874972805015495, 0.43075053350256953, 0.43058596582451375, 0.47207921081912513, 0.41211586587881549, 0.41237769689081755, 0.49366144668964007, 0.49667357347905516, 0.40353938975478298, 0.402847720295606, 0.4373946925612161, 0.52339219574006146, 0.4484624980583064, 0.41876636965574471, 0.41801757498842196, 0.41669369903532238, 0.40445888906329913, 0.46840667428864913, 0.50270122701842035, 0.47463408347309372, 0.47856620032973307, 0.40079770300890616, 0.39791488149722726, 0.40830067474023768, 0.42795607036691563, 0.42030992977187431, 0.43262688479103167, 0.40099060537542547, 0.46084332371001541, 0.40176231452965588, 0.41903526432974658, 0.50823369549778086, 0.48128200703211699, 0.41898920174367715, 0.4067321916366014, 0.45913778282285866, 0.41494142862650235, 0.44997679461469015, 0.477113041273663, 0.51738938362870324, 0.43012134140454777, 0.42065779833990019, 0.48016450484597772, 0.42666162050783996, 0.53430251720127619, 0.44879678990638677, 0.42084569185219695, 0.44194819546182162, 0.47584795266278596, 0.40246730213281179, 0.54058095483196034, 0.41139882803461569, 0.48700341421182425, 0.43661352911365126, 0.42535621322376771, 0.407846521598485, 0.50974726787945013, 0.43071086208831538, 0.42933646143333193, 0.40428428895148077, 0.39920344817941739, 0.40579672243517861, 0.45645523091138041, 0.42115678641550597, 0.41601780142368167, 0.5189610295956163, 0.4121103715100557, 0.43616523981833261, 0.40158401239702085, 0.42858278384069437, 0.64203787033209581, 0.43280314415413262, 0.40262850721047044, 0.43750868427481027, 0.47722707486798926, 0.41830598680038616, 0.47603770677497531, 0.40441306463604065, 0.44369705613565186, 0.51543268424965238, 0.43875237893227231, 0.5056956361278131, 0.51378686264583351, 0.49743727699281659, 0.4037772365969069, 0.58837740838660124, 0.42327778605670302, 0.41979551329232911, 0.41517355580821635, 0.43735883273890008, 0.40651360629889027, 0.40053041261866551, 0.43786466726779327, 0.52841417069512164, 0.56512494886474129, 0.41844413574818362, 0.42512162858402458, 0.47153875090144343, 0.41140645131457709, 0.44251951138544371, 0.44101665897651987, 0.60059720158669982, 0.42211533198727075, 0.4715346930151329, 0.49167576056977413, 0.43763115503098954, 0.4444025201402963, 0.52847334825504566, 0.42067558952919537, 0.42937272265547061, 0.42071130626683928, 0.41574748191705491, 0.48610338419091498, 0.40284186548898981, 0.43607615072299838, 0.47102714692688807, 0.48913086236015219, 0.50304988273497697, 0.46645574206058144, 0.46049834834523801, 0.47198863692264031, 0.47711793592430579, 0.4161854147184984, 0.50223189070844909, 0.40702081924147504, 0.4359193348676928, 0.59158291374827721, 0.51200451539534497, 0.40006119497023857, 0.3971615527619336, 0.4219236723548872, 0.4281077508234184, 0.41848448121775278, 0.40889878211845532, 0.41847580491065262, 0.40768093784896953, 0.43135923692685674, 0.42339081978783727, 0.44059156195289306, 0.5072661714956701, 0.42965357183000419, 0.43080383334383809, 0.42615260358362744, 0.49247530441046306, 0.4354721359858662, 0.45551066192168937, 0.46236605695210375, 0.5849371036756994, 0.43375288945648488, 0.42388169526924002, 0.43360156537398953, 0.4014558925104425, 0.40541286443021163, 0.51776499733416925, 0.47572663138018462, 0.54234377838688608, 0.4781753502703619, 0.43675545822632716, 0.62604398688028529, 0.43943371650554869, 0.43902822597629476, 0.44781344341908225, 0.42266614579615652, 0.53090289774332544, 0.62649479986716106, 0.39501545446531638, 0.44094322221128951, 0.51288012998877175, 0.41017413527617236, 0.41286454893434693, 0.42222564853773076, 0.67985645165110431, 0.40006293579259483, 0.57222083223887144, 0.4904016196685046, 0.39884468060559447, 0.53084691013592344, 0.45180923440283105, 0.44011723040108131, 0.44064252786900215, 0.40778908063883884, 0.39689980886750614, 0.47906364833048215, 0.43859889108442235, 0.50792103782284237, 0.41580493503238286, 0.57984474678608233, 0.47900932175557182, 0.72269974666384762, 0.43203561969530024, 0.41205516062986691, 0.44115554345085972, 0.42840083923586908, 0.43101637107474911, 0.47536892378770063, 0.43029746144967146, 0.43273010755998975, 0.44407792764963167, 0.40453747932724043, 0.61330492471297726, 0.47179014695369553, 0.47509164094827122, 0.42045329813053256, 0.42206159023340117, 0.47475456234265279, 0.40031264821049461, 0.44932016807069541, 0.41653570718948402, 0.42143664746931064, 0.41186797251996998, 0.40658614763972256, 0.48394409725031068, 0.53890345380990545, 0.49705187652080185, 0.46555818133203841, 0.4006496359527173, 0.46210831010700593, 0.60785242539638795, 0.47244993481282022, 0.43992099378268862, 0.44108299671716189, 0.41761404359581827, 0.42527478277251318, 0.4263082244171475, 0.48393273538452608, 0.43290500916033969, 0.55516295465651022, 0.65708116828288465, 0.47704325737766617, 0.72613064610886757, 0.40569395638599393, 0.43041684935451513, 0.40235974525680984, 0.44217218992351565, 0.42969172822786111, 0.47095943575542609, 0.40438526536687874, 0.48021411100553357, 0.47418899938480014, 0.40614597560491378, 0.43569171078909674, 0.39864512711686728, 0.49214838080658346, 0.43894695892484925, 0.42794285783725394, 0.43297062280707083, 0.4024520930679874, 0.52572511315683756, 0.43166701446030875, 0.40726888120105403, 0.40942688722855275, 0.60143986009032402, 0.48019758035715482, 0.40198495891935732, 0.42270824327902395, 0.43850092501985455, 0.49239049417446029, 0.42227955937913564, 0.47035295094160362, 0.46020378940204859, 0.53250796532545031, 0.43269996810046596, 0.43430164947416011, 0.52910294482740239, 0.4140852685533305, 0.44992442497949076, 0.48659295337657449, 0.50848745807831919, 0.416181450185102, 0.4480398262280032, 0.43178643268040617, 0.4328227269709608, 0.47630042619981544, 0.40936805904480006, 0.43389744749263687, 0.40680615348411125, 0.44250931167165408, 0.41943625728569561, 0.47506328474141779, 0.42898279206365048, 0.68833774992506214, 0.50432130286598453, 0.48743226387094601, 0.42202377096100252, 0.42083690685390379, 0.60652302295017646, 0.50954520713024964, 0.44921148699657493, 0.43238212863575848, 0.42717860885660369, 0.47644652934987336, 0.48187852818579896, 0.44513775468418482, 0.47536110647658592, 0.5366719170003017, 0.45591843920214264, 0.41618715369054676, 0.49316841556093027, 0.40849711982731746, 0.43744620849361349, 0.47786639701725991, 0.42771666578620499, 0.42593262912242702, 0.43355895823484136, 0.45952886783929087, 0.41490626742333653, 0.43281084051802421, 0.41410133093966162, 0.44787888817182075, 0.50976914688063979, 0.50075026771171349, 0.42172253958650124, 0.49623906130593354, 0.5220684528894789, 0.47624791156605001, 0.43088655218004218, 0.42661398609333734, 0.40048004686709859, 0.41402414344179289, 0.49278758849465415, 0.44817464368884063, 0.40462804120854129, 0.40291952800139147, 0.40560914731408348, 0.41725229640186418, 0.47814122752715726, 0.43793704728625166, 0.44578150668915179, 0.40780206677866304, 0.43403919041129219, 0.43966310267858449, 0.43451141249098829, 0.41550415985311462, 0.48315147777522349, 0.42289717575862074, 0.43353682480304223, 0.41301288277974685, 0.4142202759820886, 0.43601717015243291, 0.40017799925479219, 0.42780241757269338, 0.43136388596225395, 0.40551589915283093, 0.45839681364748053, 0.41926816257484145, 0.41446752713345586, 0.39904623971004927, 0.43461747394942646, 0.40895508462480795, 0.43866269535176161, 0.3938688085857423, 0.48612589706710047, 0.5070199814416676, 0.43199682056258304, 0.53566156770306694, 0.43811222990755111, 0.5764693067635055, 0.40132654392755618, 0.4291328702624283, 0.39864380822659767, 0.47563873259122441, 0.48660939695420696, 0.43429716278123426, 0.52434665089481691, 0.48375172849304626, 0.4244077487423305, 0.43090012034967956, 0.47396525260255745, 0.43519340348763214, 0.46560392777028825, 0.4492354799609512, 0.47356665164098161, 0.413553232952728, 0.42826623143695963, 0.41170629119806601, 0.56145334382042467, 0.48833887382199143, 0.46882226045442088, 0.40971320936739264, 0.40255600390606433, 0.48185484060261308, 0.43301297484479084, 0.53185598759397834, 0.47970028951421673, 0.43894755104661165, 0.44003738254421482, 0.53508028978635047, 0.4174976545534731, 0.47920418814124621, 0.52325994469088144, 0.44011256341218569, 0.44433222968131042, 0.43457266219675589, 0.48507442476490331, 0.4351977231553919, 0.43888906468641931, 0.41850535615537732, 0.47651624211915339, 0.54320841773178952, 0.40310431433326371, 0.39836615607332687, 0.45627039299539401, 0.43375856310190464, 0.41916574531129097, 0.41738472389327247, 0.41561871708974457, 0.43730487943950919, 0.41242718017506208, 0.48072012921849899, 0.43458054342746044, 0.40317944134963773, 0.43045041366051023, 0.49409730982925204, 0.40402788652106403, 0.43817297112013004, 0.7603188018003818, 0.42925965165780888, 0.41530851147202508, 0.44375754115466942, 0.41630455405010497, 0.41357386125464946, 0.43578819717947154, 0.43795888490518403, 0.42039610873198952, 0.51748138495335316, 0.40774506083010281, 0.43095636009610278, 0.44201428854488439, 0.4777028494940937, 0.40342623219683538, 0.4291754469766576, 0.41515307180979977, 0.48941588937275482, 0.43476959376323376, 0.58901535666810034, 0.4023641784654422, 0.39884509947980956, 0.4301597380559069, 0.46208945844085592, 0.43051028176155831, 0.43939261944596181, 0.43318228914778356, 0.43962870875021098, 0.42734736187468397, 0.43403947747241006, 0.47350994952295855, 0.44249509406815613, 0.41960392845788375, 0.42067727865171628, 0.51297660493021557, 0.48633285477273663, 0.43708086182158523, 0.40287680964314437, 0.44727031488970276, 0.48635046781921448, 0.43522946929729484, 0.4433796433175104, 0.41084652556546425, 0.49468905075655334, 0.51165949868135974, 0.41836846546936396, 0.39848010992809479, 0.56794277264785786, 0.40108447041018808, 0.39996936104794939, 0.42285488152521195, 0.5341626628115852, 0.4313712319541308, 0.58574145883247619, 0.43154531395293666, 0.60242389487055081, 0.44610993306549829, 0.71250400639044287, 0.47464886481522361, 0.40933974557756486, 0.43663017347291982, 0.47567681828844405, 0.44231043314468121, 0.44645243580714056, 0.49262850532318131, 0.39630241761049034, 0.41746827634316225, 0.45643906717621047, 0.40179006329381667, 0.40594636875767953, 0.46456307168052424, 0.49825543566444147, 0.4382371510074537, 0.49593221127493192, 0.43038537549614525, 0.42895205267885894, 0.45900670100943569, 0.49742053886206056, 0.4825321999584295, 0.43109871957827706, 0.42131429134477688, 0.40157932547367053, 0.54067623479279192, 0.40203738857193844, 0.4275830140089113, 0.41623388660277721, 0.47111901706664039, 0.47976898368502907, 0.41871171860077089, 0.55716063218130374, 0.40542774113506908, 0.48800505915063702, 0.39345605069081058, 0.44920369972112312, 0.42267640500160952, 0.40922018111623593, 0.48174659738408909, 0.43308305780757111, 0.43008492102350893, 0.40870194130947157, 0.71395168649470919, 0.47292241445052152, 0.54219995441429991, 0.44138307013912831, 0.46995348633950951, 0.510741976423288, 0.4406461716166164, 0.56499567951663154, 0.41920380684615077, 0.47753584448770209, 0.45079421272245807, 0.41866549987689922, 0.43313556416662335, 0.51238122626373528, 0.44619642298976703, 0.41484029761040797, 0.49074832952556025, 0.41386106345265283, 0.43340555796515207, 0.42649935706382291, 0.42674857181587467, 0.40354807253426445, 0.42175232029847914, 0.47561801189808289, 0.42444244283535953, 0.49498862399018834, 0.51401111280177791, 0.40723414766519711, 0.42935577517683132, 0.50414672588658482, 0.40184615862000733, 0.43043874251147834, 0.44524173143536661, 0.5081460913193695, 0.46866775791479581, 0.47591376633853527]\n"
          ]
        }
      ],
      "execution_count": 16,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    }
  ],
  "metadata": {
    "kernel_info": {
      "name": "python3"
    },
    "language_info": {
      "pygments_lexer": "ipython3",
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "version": "3.5.5",
      "mimetype": "text/x-python",
      "name": "python",
      "file_extension": ".py",
      "nbconvert_exporter": "python"
    },
    "kernelspec": {
      "name": "python3",
      "language": "python",
      "display_name": "Python 3"
    },
    "nteract": {
      "version": "0.15.0"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 4
}